package com.woniuxy.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.dto.GoodsEvaluateHistoryDto;
import com.woniuxy.dto.commonDto.BaseDto;
import com.woniuxy.entity.GoodsEvaluateHistory;
import com.woniuxy.mapper.GoodsEvaluateHistoryMapper;
import com.woniuxy.param.BaseParam;
import com.woniuxy.param.GoodsEvaluateHistoryParam;
import com.woniuxy.param.GoodsEvaluateParam;
import com.woniuxy.service.GoodsEvaluateHistoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniuxy.util.PageMysqlUtil;
import com.woniuxy.util.WoniuBeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 历史估价记录 服务实现类
 * </p>
 *
 * @author zcx,ftl,gr,rhs
 * @since 2022-01-06
 */
@Service
public class GoodsEvaluateHistoryServiceImpl extends ServiceImpl<GoodsEvaluateHistoryMapper, GoodsEvaluateHistory> implements GoodsEvaluateHistoryService {

    @Override//分页查询评估记录
    public BaseDto<GoodsEvaluateHistoryDto> getEvaluateHistory(GoodsEvaluateHistoryParam gehp) {
        QueryWrapper qw = new QueryWrapper();

        BaseDto<GoodsEvaluateHistoryDto> baseDto = PageMysqlUtil.pageQuery
                (GoodsEvaluateHistoryDto.class, this, qw, new BaseParam(gehp.getIndexPage(), gehp.getPageSize()));

        return baseDto;
    }

    @Override//添加评估记录
    public boolean addEvaluate(GoodsEvaluateParam gap) {
        GoodsEvaluateHistory goodsAppraisalHistory = WoniuBeanUtils.copyObject(gap, GoodsEvaluateHistory.class);
        return save(goodsAppraisalHistory);
    }
}
